package game.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import common.controller.base.BaseController;
import common.model.po.GBlueprintAuthor;
import common.model.request.base.PaginationRequest;
import common.model.response.base.Result;
import game.model.request.SaveBlueprintAuthorRequest;
import game.model.request.SearchBlueprintAuthorRequest;
import game.service.GBlueprintAuthorService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 前端控制器
 *
 * @author 米泽鹏
 * @since 2024-08-17 下午 06:02
 */
@RestController
@RequestMapping("/game/g-blueprint-author")
public class GBlueprintAuthorController extends BaseController {

	@Resource
	private GBlueprintAuthorService service;

	@ApiOperation(value = "蓝图作者分页查询", notes = "蓝图作者分页查询")
	@PostMapping("/readOnly/pageBlueprintAuthor")
	public Result<Page<GBlueprintAuthor>> pageBlueprintAuthor(@ApiParam(value = "蓝图作者分页查询请求", required = true) @RequestBody @Validated PaginationRequest<SearchBlueprintAuthorRequest, GBlueprintAuthor> paginationRequest) {
		return successWithData(service.pageBlueprintAuthor(paginationRequest));
	}

	@ApiOperation(value = "蓝图作者新增或更新", notes = "蓝图作者新增或更新")
	@PostMapping("/saveBlueprintAuthor")
	public Result<?> saveBlueprintAuthor(@ApiParam(value = "蓝图作者新增或更新", required = true) @RequestBody @Validated SaveBlueprintAuthorRequest request) {
		return service.saveBlueprintAuthor(request);
	}

	@ApiOperation(value = "蓝图作者删除", notes = "蓝图作者删除")
	@DeleteMapping("/deleteBlueprintAuthor/{id}")
	public Result<?> deleteBlueprintAuthor(@ApiParam(value = "蓝图作者id", required = true) @PathVariable Long id) {
		return service.deleteBlueprintAuthor(id);
	}

}
